package com.bootdo.log.service.impl;

import com.bootdo.log.dao.LogDao;
import com.bootdo.log.domain.LogDO;
import com.bootdo.common.domain.PageDO;
import com.bootdo.log.service.LogService;
import com.bootdo.common.utils.Query;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
@Slf4j
public class LogServiceImpl implements LogService {

    @Resource
    LogDao logDao;

    @Override
    public void save(LogDO logDO) {
        logDao.save(logDO);
    }

    @Override
    public PageDO<LogDO> queryList(Query query) {
        int total = logDao.count(query);
        List<LogDO> logs = logDao.list(query);
        PageDO<LogDO> page = new PageDO<>();
        page.setTotal(total);
        page.setRows(logs);
        return page;
    }

    @Override
    public int remove(Long id) {
        int count = logDao.remove(id);
        return count;
    }

    @Override
    public int batchRemove(Long[] ids) {
        return logDao.batchRemove(ids);
    }
}
